import java.util.Scanner;

public class javazfx_1 {
    public static void main(String args[]){
        Scanner reader = new Scanner(System.in);
        String target;
        long count = 0;
        target = reader.next();
        while(reader.hasNext()){
            String crap = reader.next();
            if(crap.substring(0, 1).equals(target))
            {
                count +=1;
            }
        }
        System.out.println(count);
    }
}